<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var BC = {
            num: 0,
            result: 0,
            number: function (num) {
                this.num = this.result = num;
                return this;
            },
            add: function (num) {
                this.result = floatObj.bcadd(this.result, num);
                return this;
            },
            sub: function (num) {
                this.result = floatObj.bcsub(this.result, num);
                return this;
            },
            mul: function (num) {
                this.result = floatObj.bcmul(this.result, num);
                return this;
            },
            div: function (num) {
                this.result = floatObj.bcdiv(this.result, num);
                return this;
            },
            getResult: function () {
                return this.result;
            }
        }

        //以下表达式代表：1 +2 - 1.1
        var result = BC.number(1).add(2).sub(1.1).getResult();
        console.log(result);
    </script>
</body>

</html>